﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DotNetCore.BannerManagement.Domain;
using Microsoft.Practices.Repository;

using System.Globalization;

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_AdvertisementRepositoryArtifacts
{
    /// <summary>
    /// A class that converts a dnc_Advertisement
    /// into a DbCommand that will delete
    /// that dnc_Advertisement.
    /// </summary>
    internal class dnc_AdvertisementDeleteFactory : IDeleteFactory<System.Int32>
    {
        /// <summary>
        /// Creates the dnc_AdvertisementDeleteFactory to build a delete statement for
        /// the given System.Int32.
        /// </summary>
        /// <param name="System.Int32">System.Int32 to delete from the database.</param>    
        public dnc_AdvertisementDeleteFactory()
        {
        }
       
        #region IDeleteFactory<System.Int32> Members
        public DbCommand ConstructDeleteCommand(Database db, System.Int32 iD)
        {
            DbCommand command = db.GetStoredProcCommand("dbo.Deletednc_Advertisement");
			db.AddInParameter(command, "iD", DbType.Int32, iD);
			return command;
        }
        #endregion
        
        #region IDbToBusinessEntityNameMapper Members
        /// <summary>
        /// Maps a field name in the database (usually a parameter name for a stored proc)
        /// to the corresponding business entity property name.
        /// </summary>
        /// <remarks>This method is intended for error message handling, not for reflection.</remarks>
        /// <param name="dbParameter">Name of field/parameter that the database knows about.</param>
        /// <returns>Corresponding business entity field name.</returns>
        public string MapDbParameterToBusinessEntityProperty(string dbParameter)
        {
            switch (dbParameter)
            {
				case "iD":
					return "iD";
				default:
					throw new Exception(dbParameter);
			}
        }
        #endregion        
    }
}

